/**
 * Created by ren on 10/04/2017.
 */
import React, {Component} from 'react';
import {
  StyleSheet,
  Platform,
  Image,
  Dimensions,
  StatusBar,
  TouchableWithoutFeedback,
  Linking
}from 'react-native';
import {Container, Content, Text, List, ListItem, Left, Icon, Body, Right, Button, Header, Title} from 'native-base'
import {getSize} from '../../utils/response'
import PageUtil from '../../utils/PageUtil'
export default class Services extends Component {
  constructor(props, context) {
    super(props, context);
    this.PageUtil = new PageUtil()
  }

  callMe(url) {
    Linking.canOpenURL(url).then(supported => {
      if (!supported) {
        console.log('Can\'t handle url: ' + url);
      } else {
        return Linking.openURL(url);
      }
    }).catch(err => console.error('An error occurred', err));

  }

  render() {
    return (
      <Container style={{backgroundColor:'white'}}>
        <Header iosBarStyle="light-content" backgroundColor="#16BD42"
                style={{backgroundColor:'#16BD42',height:Platform.OS==='ios'?getSize(64):getSize(50),borderBottomWidth:0,marginBottom:getSize(7)}}>
          <StatusBar
            backgroundColor={'#303135'}
          />
          <Left style={{flex:1}}>
            <Button transparent onPress={this.PageUtil.pop}>
              <Icon name='arrow-back' style={{fontSize:getSize(24),color:'white'}}/>
            </Button>
          </Left>
          <Body style={{alignItems:'center'}}>
          <Title style={{color:'white',fontSize:getSize(19)}}>联系客服</Title>
          </Body>
          <Right style={{flex:1}}>
            <Button transparent>
            </Button>
          </Right>
        </Header>
        <Content>
          <Text
            style={{fontSize:getSize(44),textAlign:'center',fontWeight:'bold',marginTop:getSize(121)}}>400-8525-755</Text>
          <Text note style={{textAlign:'center',marginTop:getSize(22)}}>周一至周日 8:00至18:00</Text>
          <Button
            block
            onPress={(url)=>this.callMe('tel:4008525755')}
            style={{marginLeft:getSize(32),marginRight:getSize(32),marginTop:getSize(113),borderRadius: getSize(20),height:getSize(39),backgroundColor:'#16BD42'}}
          >
            <Text style={{color:'white',fontSize:getSize(15)}}>呼叫客服</Text>
          </Button>
        </Content>
      </Container>
    )
  }
}
const styles = {
  text: {
    color: '#696969',
    fontSize: getSize(16)
  },
  rightBtn: {
    flex: 1,
    flexDirection: 'row',
    alignItems: 'center',
    justifyContent: 'flex-end'
  },
  rightBtnText: {
    marginRight: getSize(10)
  }
}